<!doctype html>
<html lang="en">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
          integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

    <title>登录页面</title>
</head>
<body style="background-color: #C9C5C5">
<div class="container">

    <div style="width: 500px;height: 300px;left: 40%;top: 40%;margin: auto;position: absolute;opacity: 0.8">
        <p>Login</p>
        <div class="input-group" style="width: 50%">
            <input type="text" class="form-control" id="username" required placeholder="请输入用户名" aria-label="请输入用户名"
                   aria-describedby="basic-addon2">
        </div>
        <div class="input-group" style="margin-top: 20px; width: 50%">
            <input type="password" class="form-control" id="password" required placeholder="请输入密码" aria-label="请输入密码"
                   aria-describedby="basic-addon2">
        </div>
        <button type="button" id="sub" class="btn btn-dark" style="margin-top: 20px">登录</button>
    </div>
</div>


<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script
        src="http://code.jquery.com/jquery-3.3.1.min.js"
        integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
        crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
        integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
        crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
        integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
        crossorigin="anonymous"></script>
<script>
    $("#sub").onclick(function () {
        var username = $("#username").val();
        var password = $("#password").val();

        $.ajax({
            url:"/seller/login",
            type: "post",
            contentType: "application/json",
            dataType: "json",
            data: JSON.stringify({'username': username, 'password': password}),
            success: function (data) {
                console.log(data);
                if (data.code == 0) {
                    window.location.href = "order/list";
                }
            }
        })
    })
</script>
</body>
</html>